package cn.virens.web.components.shiro.oauth2.ex;

import org.apache.shiro.authc.AuthenticationException;

import cn.virens.exception.APIExceptionInter;

public class Oauth2AuthenticationException extends AuthenticationException {
	private static final long serialVersionUID = 1011087756257006298L;

	private String errorDesc;
	private String error;

	public Oauth2AuthenticationException(APIExceptionInter exception) {
		this.errorDesc = exception.getMessage();
		this.error = exception.getCode();
	}

	public String getError() {
		return error;
	}

	public void setError(String error) {
		this.error = error;
	}

	public String getErrorDesc() {
		return errorDesc;
	}

	public void setErrorDesc(String errorDesc) {
		this.errorDesc = errorDesc;
	}

	@Override
	public String getMessage() {
		return toString();
	}

	@Override
	public String toString() {
		return "Oauth2AuthenticationException [error=" + error + ", errorDesc=" + errorDesc + "]";
	}

}
